import axios from "../index.js";



// 组织机构树
export const tree = (data) => {
  return axios.request({
    url: "/system/organization/tree",
    // url: "/system/organization/getOrganizationUntilList",
    method: "post",
    data: data
  });
};

// 组织机构详情
export const getById = (data) => {
  return axios.request({
    url: "/system/organization/getById",
    method: "get",
    data: data
  });
};

// 组织机构下属机构列表
export const doList = (data) => {
  return axios.request({
    url: "/system/organization/doPageList",
    method: "post",
    data: data
  });
};

// 组织机构关联用户
export const saveOrgAccount = (data) => {
  return axios.request({
    url: "/system/organization/saveOrgAccount",
    method: "post",
    data: data
  });
};

// 修改组织机构
export const doUpdById = (data) => {
  return axios.request({
    url: "/system/organization/doAdjust",
    // url: "/system/organization/doUpdById",
    method: "post",
    data: data
  });
};

// 查询指定机构下面的用户信息集合
export const postAccountByOrg = (orgId, accountName = "", realName = "") => {
  return axios.request({
    url: `/system/account/getAccountByOrg?orgId=${orgId}&accountName=${accountName}&realName=${realName}`,
    method: "post"
  });
};
export const getAccountByOrg = (data) => {
  return axios.request({
    url: "/system/account/getAccountByOrg",
    method: "post",
    data: data
  });
};
// 删除指定机构下的账户
export const deleteJgAccount = (data) => {
  return axios.request({
    url: "/system/organization/doDeleteOrgAccount",
    method: "post",
    data: data
  });
};

// 组织机构新增
export const organizationAdd = (data) => {
  return axios.request({
    url: "/system/organization/save",
    method: "post",
    data: data
  });
};


// 组织机构删除
export const organizationDelete = (data) => {
  return axios.request({
    url: `/system/organization/doDelete?id=${data}`,
    method: "get"
  });
};


// 组织机构刷新缓存
export const refresh = (data) => {
  return axios.request({
    url: `/system/organization/refresh`,
    method: "post",
    data: data
  });
};

// 获取湖北省下一级单位集合（包含湖北省电力有限公司）
export const getHomePageInfo = () => {
  return axios.request({
    url: `/system/organization/getHomePageInfo`,
    method: "get"
  });
};

// 获取湖北省下一级单位集合（包含湖北省电力有限公司）
export const getTrees = () => {
  return axios.request({
    url: `/system/organization/getTrees`,
    method: "get"
  });
};


